package com.azier.exception;

import com.azier.util.StringUtil;

import java.sql.SQLException;

/**
 * 服务异常
 */
public class ServiceException extends Exception {

    private static final long serialVersionUID = 6533708658839930224L;

    public ServiceException(){
        super();
    }

    public ServiceException(Throwable cause){
        super(cause);
    }

    public ServiceException(String message){
        super(message);
    }

    public ServiceException(String message, Throwable cause){
        super((cause instanceof SQLException)? StringUtil.format("{}, ErrorCode: {}", message, ((SQLException) cause).getErrorCode()) :message, cause);
    }

}
